import java.util.Comparator;

/*
 * Amos Kittelson 
 * COP3503 - Computer Science 2
 * Assignment 3 - Railroad Building
 * Due 6 July 2010 (Extended due to military duty)
 */

public class Vertex implements Comparable<Vertex>, Comparator<Vertex> {

	// Vertex has a label (Ex: city name)
	private String label;
	
	// Constructor
	public Vertex(String s){
		this.label = s;
	}
		
	// Set the Vertex label
	public void setLabel(String s){
		label = s;
	}
	
	// Return the Vertex's label
	// TODO: getLabel() redundant - implement toString in main code
	public String getLabel(){
		return label;
	}
	
	// For sorting alphabetically by label
	public int compareTo(Vertex v) {
		return label.compareTo(v.getLabel());
	}
	
	public String toString(){
		// return "Id: " + id + " Label:" + label;
		return label;
	}
	
	// Return the Object pointer
	public Vertex getObject(){
		return this;
	}

	// Required by Comparator interface
	public int compare(Vertex a, Vertex b) {
		return a.label.compareTo(b.label);
	}
	
	
}


